package com.jsoft.test;/**
 * @author snkstart
 * @create 2023-02-22 23:19
 */

import com.jsoft.dao.TicketEnterInstiDao;
import com.jsoft.dao.impl.TicketEnterInstiDaoImpl;
import com.jsoft.entity.po.TicketEnterInsti;
import org.junit.Test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 *@ClassName testTicketEnterInsi
 *@Description TODO
 *@Author jindong
 *@Date 2023/2/22 23:19
 *@Version 1.0
 */

public class testTicketEnterInsi {
    private TicketEnterInstiDao ticketEnterInstiDao=new TicketEnterInstiDaoImpl();
    @Test
    public void testselectAll(){
        try {
            List<TicketEnterInsti> ticketEnterInstis = ticketEnterInstiDao.selectAll();
            for (TicketEnterInsti ticketEnterInsti : ticketEnterInstis) {
                System.out.println(ticketEnterInsti);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }



    @Test
    public void testselectTicketEnterInstiById(){
        try {
            TicketEnterInsti ticketEnterInsti = ticketEnterInstiDao.selectTicketEnterInstiById(2);
            System.out.println(ticketEnterInsti);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Test
    public void testupdateStatusById(){
        try {
            int res = ticketEnterInstiDao.updateStatusById(2);
            System.out.println(res);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    @Test
    public void testchangeStatusById(){
        try {
            int res = ticketEnterInstiDao.changeStatusById(6);
            System.out.println(res);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    @Test
    public void testCheckTicketByView(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String dateStr="2022-11-18";
        Date parse=null;
        try {
             parse= simpleDateFormat.parse(dateStr);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        try {
            List<TicketEnterInsti> ticketEnterInstis = ticketEnterInstiDao.CheckTicketByView(null, null, null, null, parse, null);
            for (TicketEnterInsti ticketEnterInsti : ticketEnterInstis) {
                System.out.println(ticketEnterInsti);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    @Test
    public void testfindOpenList(){
        try {
            List<TicketEnterInsti> admin = ticketEnterInstiDao.findOpenList();
            for (TicketEnterInsti ticketEnterInsti : admin) {
                System.out.println(ticketEnterInsti);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
